﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract Virman typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class VirmanDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<VirmanDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.Virman _currentVirman = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxVirmanDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxVirmanErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxVirmanBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NalogodavateljaNaziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNalogodavateljaNazivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NalogodavateljaSjediste property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNalogodavateljaSjedisteDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NalogodavateljRacun property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNalogodavateljRacunDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the BrojZaduzenjaModel property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxBrojZaduzenjaModelDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the BrojZaduzenjaPoziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxBrojZaduzenjaPozivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SvrhaDoznake property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSvrhaDoznakeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the PrimateljNaziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPrimateljNazivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the PrimateljSjediste property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPrimateljSjedisteDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the PrimateljRacun property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPrimateljRacunDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the BrojOdobrenjaModel property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxBrojOdobrenjaModelDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the BrojOdobrenjaPoziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxBrojOdobrenjaPozivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Iznos property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIznosDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumIzvrsenja property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumIzvrsenjaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Placen property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxPlacenDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKnjizenja property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKnjizenjaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKlijent property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKlijentDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Calculated property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxCalculatedDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumDospijeca property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumDospijecaDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Klijent> _IDKlijentList;
		
		/// <summary> 
		/// The list of selectable Klijent
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Klijent> IDKlijentList
		{
			get {return this._IDKlijentList;}
			set 
			{
				this._IDKlijentList = value;
				this.uxIDKlijentDataGridViewColumn.DataSource = null;
				this.uxIDKlijentDataGridViewColumn.DataSource = this._IDKlijentList;
			}
		}
		
		private bool _allowNewItemInIDKlijentList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Klijent
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKlijentList
		{
			get { return _allowNewItemInIDKlijentList;}
			set
			{
				this._allowNewItemInIDKlijentList = value;
				this.uxIDKlijentDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.KnjizenjeStavka> _IDKnjizenjaList;
		
		/// <summary> 
		/// The list of selectable KnjizenjeStavka
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.KnjizenjeStavka> IDKnjizenjaList
		{
			get {return this._IDKnjizenjaList;}
			set 
			{
				this._IDKnjizenjaList = value;
				this.uxIDKnjizenjaDataGridViewColumn.DataSource = null;
				this.uxIDKnjizenjaDataGridViewColumn.DataSource = this._IDKnjizenjaList;
			}
		}
		
		private bool _allowNewItemInIDKnjizenjaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of KnjizenjeStavka
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKnjizenjaList
		{
			get { return _allowNewItemInIDKnjizenjaList;}
			set
			{
				this._allowNewItemInIDKnjizenjaList = value;
				this.uxIDKnjizenjaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.Virman> _VirmanList;
				
		/// <summary> 
		/// The list of Virman to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.Virman> VirmanList
		{
			get {return this._VirmanList;}
			set
			{
				this._VirmanList = value;
				this.uxVirmanBindingSource.DataSource = null;
				this.uxVirmanBindingSource.DataSource = value;
				this.uxVirmanDataGridView.DataSource = null;
				this.uxVirmanDataGridView.DataSource = this.uxVirmanBindingSource;				
				//this.uxVirmanBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxVirmanBindingSource_ListChanged);
				this.uxVirmanBindingSource.CurrentItemChanged += new System.EventHandler(OnVirmanBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnVirmanBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentVirman = uxVirmanBindingSource.Current as Entities.Virman;
			
			if (_currentVirman != null)
			{
				_currentVirman.Validate();
			}
			//_Virman.Validate();
			OnCurrentEntityChanged();
		}

		//void uxVirmanBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.Virman"/> instance.
		/// </summary>
		public Entities.Virman SelectedVirman
		{
			get {return this._currentVirman;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxVirmanDataGridView.VirtualMode;}
			set
			{
				this.uxVirmanDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxVirmanDataGridView.AllowUserToAddRows;}
			set {this.uxVirmanDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxVirmanDataGridView.AllowUserToDeleteRows;}
			set {this.uxVirmanDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxVirmanDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxVirmanDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="VirmanDataGridViewBase"/> class.
		/// </summary>
		public VirmanDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxVirmanDataGridView = new System.Windows.Forms.DataGridView();
			this.uxVirmanBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxVirmanErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNalogodavateljaNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNalogodavateljaSjedisteDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNalogodavateljRacunDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxBrojZaduzenjaModelDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxBrojZaduzenjaPozivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSvrhaDoznakeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPrimateljNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPrimateljSjedisteDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPrimateljRacunDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxBrojOdobrenjaModelDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxBrojOdobrenjaPozivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIznosDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumIzvrsenjaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPlacenDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxIDKnjizenjaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDKlijentDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxCalculatedDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumDospijecaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDKlijentBindingSource = new KlijentBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKlijentBindingSource)).BeginInit();
			//this.uxIDKnjizenjaBindingSource = new KnjizenjeStavkaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKnjizenjaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxVirmanDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxVirmanBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxVirmanErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxVirmanErrorProvider
			// 
			this.uxVirmanErrorProvider.ContainerControl = this;
			this.uxVirmanErrorProvider.DataSource = this.uxVirmanBindingSource;						
			// 
			// uxVirmanDataGridView
			// 
			this.uxVirmanDataGridView.AutoGenerateColumns = false;
			this.uxVirmanDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxVirmanDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxNalogodavateljaNazivDataGridViewColumn,
		this.uxNalogodavateljaSjedisteDataGridViewColumn,
		this.uxNalogodavateljRacunDataGridViewColumn,
		this.uxBrojZaduzenjaModelDataGridViewColumn,
		this.uxBrojZaduzenjaPozivDataGridViewColumn,
		this.uxSvrhaDoznakeDataGridViewColumn,
		this.uxPrimateljNazivDataGridViewColumn,
		this.uxPrimateljSjedisteDataGridViewColumn,
		this.uxPrimateljRacunDataGridViewColumn,
		this.uxBrojOdobrenjaModelDataGridViewColumn,
		this.uxBrojOdobrenjaPozivDataGridViewColumn,
		this.uxIznosDataGridViewColumn,
		this.uxDatumIzvrsenjaDataGridViewColumn,
		this.uxPlacenDataGridViewColumn,
		this.uxIDKnjizenjaDataGridViewColumn,
		this.uxIDKlijentDataGridViewColumn,
		this.uxCalculatedDataGridViewColumn,
		this.uxDatumDospijecaDataGridViewColumn			});
			this.uxVirmanDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxVirmanDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxVirmanDataGridView.Name = "uxVirmanDataGridView";
			this.uxVirmanDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxVirmanDataGridView.TabIndex = 0;	
			this.uxVirmanDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxVirmanDataGridView.EnableHeadersVisualStyles = false;
			this.uxVirmanDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnVirmanDataGridViewDataError);
			this.uxVirmanDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnVirmanDataGridViewCellValueNeeded);
			this.uxVirmanDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnVirmanDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxNalogodavateljaNazivDataGridViewColumn
			//
			this.uxNalogodavateljaNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNalogodavateljaNazivDataGridViewColumn.DataPropertyName = "NalogodavateljaNaziv";
			this.uxNalogodavateljaNazivDataGridViewColumn.HeaderText = "NalogodavateljaNaziv";
			this.uxNalogodavateljaNazivDataGridViewColumn.Name = "uxNalogodavateljaNazivDataGridViewColumn";
			this.uxNalogodavateljaNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNalogodavateljaNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNalogodavateljaNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxNalogodavateljaSjedisteDataGridViewColumn
			//
			this.uxNalogodavateljaSjedisteDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNalogodavateljaSjedisteDataGridViewColumn.DataPropertyName = "NalogodavateljaSjediste";
			this.uxNalogodavateljaSjedisteDataGridViewColumn.HeaderText = "NalogodavateljaSjediste";
			this.uxNalogodavateljaSjedisteDataGridViewColumn.Name = "uxNalogodavateljaSjedisteDataGridViewColumn";
			this.uxNalogodavateljaSjedisteDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNalogodavateljaSjedisteDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNalogodavateljaSjedisteDataGridViewColumn.ReadOnly = false;		
			//
			// uxNalogodavateljRacunDataGridViewColumn
			//
			this.uxNalogodavateljRacunDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNalogodavateljRacunDataGridViewColumn.DataPropertyName = "NalogodavateljRacun";
			this.uxNalogodavateljRacunDataGridViewColumn.HeaderText = "NalogodavateljRacun";
			this.uxNalogodavateljRacunDataGridViewColumn.Name = "uxNalogodavateljRacunDataGridViewColumn";
			this.uxNalogodavateljRacunDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNalogodavateljRacunDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNalogodavateljRacunDataGridViewColumn.ReadOnly = false;		
			//
			// uxBrojZaduzenjaModelDataGridViewColumn
			//
			this.uxBrojZaduzenjaModelDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxBrojZaduzenjaModelDataGridViewColumn.DataPropertyName = "BrojZaduzenjaModel";
			this.uxBrojZaduzenjaModelDataGridViewColumn.HeaderText = "BrojZaduzenjaModel";
			this.uxBrojZaduzenjaModelDataGridViewColumn.Name = "uxBrojZaduzenjaModelDataGridViewColumn";
			this.uxBrojZaduzenjaModelDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxBrojZaduzenjaModelDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxBrojZaduzenjaModelDataGridViewColumn.ReadOnly = false;		
			//
			// uxBrojZaduzenjaPozivDataGridViewColumn
			//
			this.uxBrojZaduzenjaPozivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxBrojZaduzenjaPozivDataGridViewColumn.DataPropertyName = "BrojZaduzenjaPoziv";
			this.uxBrojZaduzenjaPozivDataGridViewColumn.HeaderText = "BrojZaduzenjaPoziv";
			this.uxBrojZaduzenjaPozivDataGridViewColumn.Name = "uxBrojZaduzenjaPozivDataGridViewColumn";
			this.uxBrojZaduzenjaPozivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxBrojZaduzenjaPozivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxBrojZaduzenjaPozivDataGridViewColumn.ReadOnly = false;		
			//
			// uxSvrhaDoznakeDataGridViewColumn
			//
			this.uxSvrhaDoznakeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSvrhaDoznakeDataGridViewColumn.DataPropertyName = "SvrhaDoznake";
			this.uxSvrhaDoznakeDataGridViewColumn.HeaderText = "SvrhaDoznake";
			this.uxSvrhaDoznakeDataGridViewColumn.Name = "uxSvrhaDoznakeDataGridViewColumn";
			this.uxSvrhaDoznakeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSvrhaDoznakeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSvrhaDoznakeDataGridViewColumn.ReadOnly = false;		
			//
			// uxPrimateljNazivDataGridViewColumn
			//
			this.uxPrimateljNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPrimateljNazivDataGridViewColumn.DataPropertyName = "PrimateljNaziv";
			this.uxPrimateljNazivDataGridViewColumn.HeaderText = "PrimateljNaziv";
			this.uxPrimateljNazivDataGridViewColumn.Name = "uxPrimateljNazivDataGridViewColumn";
			this.uxPrimateljNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPrimateljNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPrimateljNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxPrimateljSjedisteDataGridViewColumn
			//
			this.uxPrimateljSjedisteDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPrimateljSjedisteDataGridViewColumn.DataPropertyName = "PrimateljSjediste";
			this.uxPrimateljSjedisteDataGridViewColumn.HeaderText = "PrimateljSjediste";
			this.uxPrimateljSjedisteDataGridViewColumn.Name = "uxPrimateljSjedisteDataGridViewColumn";
			this.uxPrimateljSjedisteDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPrimateljSjedisteDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPrimateljSjedisteDataGridViewColumn.ReadOnly = false;		
			//
			// uxPrimateljRacunDataGridViewColumn
			//
			this.uxPrimateljRacunDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPrimateljRacunDataGridViewColumn.DataPropertyName = "PrimateljRacun";
			this.uxPrimateljRacunDataGridViewColumn.HeaderText = "PrimateljRacun";
			this.uxPrimateljRacunDataGridViewColumn.Name = "uxPrimateljRacunDataGridViewColumn";
			this.uxPrimateljRacunDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPrimateljRacunDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPrimateljRacunDataGridViewColumn.ReadOnly = false;		
			//
			// uxBrojOdobrenjaModelDataGridViewColumn
			//
			this.uxBrojOdobrenjaModelDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxBrojOdobrenjaModelDataGridViewColumn.DataPropertyName = "BrojOdobrenjaModel";
			this.uxBrojOdobrenjaModelDataGridViewColumn.HeaderText = "BrojOdobrenjaModel";
			this.uxBrojOdobrenjaModelDataGridViewColumn.Name = "uxBrojOdobrenjaModelDataGridViewColumn";
			this.uxBrojOdobrenjaModelDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxBrojOdobrenjaModelDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxBrojOdobrenjaModelDataGridViewColumn.ReadOnly = false;		
			//
			// uxBrojOdobrenjaPozivDataGridViewColumn
			//
			this.uxBrojOdobrenjaPozivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxBrojOdobrenjaPozivDataGridViewColumn.DataPropertyName = "BrojOdobrenjaPoziv";
			this.uxBrojOdobrenjaPozivDataGridViewColumn.HeaderText = "BrojOdobrenjaPoziv";
			this.uxBrojOdobrenjaPozivDataGridViewColumn.Name = "uxBrojOdobrenjaPozivDataGridViewColumn";
			this.uxBrojOdobrenjaPozivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxBrojOdobrenjaPozivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxBrojOdobrenjaPozivDataGridViewColumn.ReadOnly = false;		
			//
			// uxIznosDataGridViewColumn
			//
			this.uxIznosDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIznosDataGridViewColumn.DataPropertyName = "Iznos";
			this.uxIznosDataGridViewColumn.HeaderText = "Iznos";
			this.uxIznosDataGridViewColumn.Name = "uxIznosDataGridViewColumn";
			this.uxIznosDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIznosDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIznosDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumIzvrsenjaDataGridViewColumn
			//
			this.uxDatumIzvrsenjaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumIzvrsenjaDataGridViewColumn.DataPropertyName = "DatumIzvrsenja";
			this.uxDatumIzvrsenjaDataGridViewColumn.HeaderText = "DatumIzvrsenja";
			this.uxDatumIzvrsenjaDataGridViewColumn.Name = "uxDatumIzvrsenjaDataGridViewColumn";
			this.uxDatumIzvrsenjaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumIzvrsenjaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumIzvrsenjaDataGridViewColumn.ReadOnly = false;		
			//
			// uxPlacenDataGridViewColumn
			//
			this.uxPlacenDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPlacenDataGridViewColumn.DataPropertyName = "Placen";
			this.uxPlacenDataGridViewColumn.HeaderText = "Placen";
			this.uxPlacenDataGridViewColumn.Name = "uxPlacenDataGridViewColumn";
			this.uxPlacenDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPlacenDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPlacenDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKnjizenjaDataGridViewColumn
			//
			this.uxIDKnjizenjaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKnjizenjaDataGridViewColumn.DataPropertyName = "IDKnjizenja";
			this.uxIDKnjizenjaDataGridViewColumn.HeaderText = "IDKnjizenja";
			this.uxIDKnjizenjaDataGridViewColumn.Name = "uxIDKnjizenjaDataGridViewColumn";
			this.uxIDKnjizenjaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKnjizenjaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKnjizenjaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKlijentDataGridViewColumn
			//
			this.uxIDKlijentDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKlijentDataGridViewColumn.DataPropertyName = "IDKlijent";
			this.uxIDKlijentDataGridViewColumn.HeaderText = "IDKlijent";
			this.uxIDKlijentDataGridViewColumn.Name = "uxIDKlijentDataGridViewColumn";
			this.uxIDKlijentDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKlijentDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKlijentDataGridViewColumn.ReadOnly = false;		
			//
			// uxCalculatedDataGridViewColumn
			//
			this.uxCalculatedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxCalculatedDataGridViewColumn.DataPropertyName = "Calculated";
			this.uxCalculatedDataGridViewColumn.HeaderText = "Calculated";
			this.uxCalculatedDataGridViewColumn.Name = "uxCalculatedDataGridViewColumn";
			this.uxCalculatedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxCalculatedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxCalculatedDataGridViewColumn.ReadOnly = true;		
			//
			// uxDatumDospijecaDataGridViewColumn
			//
			this.uxDatumDospijecaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumDospijecaDataGridViewColumn.DataPropertyName = "DatumDospijeca";
			this.uxDatumDospijecaDataGridViewColumn.HeaderText = "DatumDospijeca";
			this.uxDatumDospijecaDataGridViewColumn.Name = "uxDatumDospijecaDataGridViewColumn";
			this.uxDatumDospijecaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumDospijecaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumDospijecaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKlijentDataGridViewColumn
			//				
			this.uxIDKlijentDataGridViewColumn.DisplayMember = "ImeKlijenta";	
			this.uxIDKlijentDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKlijentDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKlijentDataGridViewColumn.DataSource = uxIDKlijentBindingSource;				
				
			//
			// uxIDKnjizenjaDataGridViewColumn
			//				
			this.uxIDKnjizenjaDataGridViewColumn.DisplayMember = "IDKonto";	
			this.uxIDKnjizenjaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKnjizenjaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKnjizenjaDataGridViewColumn.DataSource = uxIDKnjizenjaBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxVirmanDataGridView);
			this.Name = "VirmanDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKlijentBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKnjizenjaBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxVirmanErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxVirmanDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxVirmanBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				VirmanDataGridViewEventArgs args = new VirmanDataGridViewEventArgs();
				args.Virman = _currentVirman;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class VirmanDataGridViewEventArgs : System.EventArgs
		{
			private Entities.Virman	_Virman;
	
			/// <summary>
			/// the  Entities.Virman instance.
			/// </summary>
			public Entities.Virman Virman
			{
				get { return _Virman; }
				set { _Virman = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxVirmanDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnVirmanDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxVirmanDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnVirmanDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxVirmanDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].ID;
						break;
					case "uxNalogodavateljaNazivDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].NalogodavateljaNaziv;
						break;
					case "uxNalogodavateljaSjedisteDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].NalogodavateljaSjediste;
						break;
					case "uxNalogodavateljRacunDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].NalogodavateljRacun;
						break;
					case "uxBrojZaduzenjaModelDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].BrojZaduzenjaModel;
						break;
					case "uxBrojZaduzenjaPozivDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].BrojZaduzenjaPoziv;
						break;
					case "uxSvrhaDoznakeDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].SvrhaDoznake;
						break;
					case "uxPrimateljNazivDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].PrimateljNaziv;
						break;
					case "uxPrimateljSjedisteDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].PrimateljSjediste;
						break;
					case "uxPrimateljRacunDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].PrimateljRacun;
						break;
					case "uxBrojOdobrenjaModelDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].BrojOdobrenjaModel;
						break;
					case "uxBrojOdobrenjaPozivDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].BrojOdobrenjaPoziv;
						break;
					case "uxIznosDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].Iznos;
						break;
					case "uxDatumIzvrsenjaDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].DatumIzvrsenja;
						break;
					case "uxPlacenDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].Placen;
						break;
					case "uxIDKnjizenjaDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].IDKnjizenja;
						break;
					case "uxIDKlijentDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].IDKlijent;
						break;
					case "uxCalculatedDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].Calculated;
						break;
					case "uxDatumDospijecaDataGridViewColumn":
						e.Value = VirmanList[e.RowIndex].DatumDospijeca;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxVirmanDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnVirmanDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxVirmanDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						VirmanList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxNalogodavateljaNazivDataGridViewColumn":
						VirmanList[e.RowIndex].NalogodavateljaNaziv = (System.String)e.Value;
						break;
					case "uxNalogodavateljaSjedisteDataGridViewColumn":
						VirmanList[e.RowIndex].NalogodavateljaSjediste = (System.String)e.Value;
						break;
					case "uxNalogodavateljRacunDataGridViewColumn":
						VirmanList[e.RowIndex].NalogodavateljRacun = (System.String)e.Value;
						break;
					case "uxBrojZaduzenjaModelDataGridViewColumn":
						VirmanList[e.RowIndex].BrojZaduzenjaModel = (System.String)e.Value;
						break;
					case "uxBrojZaduzenjaPozivDataGridViewColumn":
						VirmanList[e.RowIndex].BrojZaduzenjaPoziv = (System.String)e.Value;
						break;
					case "uxSvrhaDoznakeDataGridViewColumn":
						VirmanList[e.RowIndex].SvrhaDoznake = (System.String)e.Value;
						break;
					case "uxPrimateljNazivDataGridViewColumn":
						VirmanList[e.RowIndex].PrimateljNaziv = (System.String)e.Value;
						break;
					case "uxPrimateljSjedisteDataGridViewColumn":
						VirmanList[e.RowIndex].PrimateljSjediste = (System.String)e.Value;
						break;
					case "uxPrimateljRacunDataGridViewColumn":
						VirmanList[e.RowIndex].PrimateljRacun = (System.String)e.Value;
						break;
					case "uxBrojOdobrenjaModelDataGridViewColumn":
						VirmanList[e.RowIndex].BrojOdobrenjaModel = (System.String)e.Value;
						break;
					case "uxBrojOdobrenjaPozivDataGridViewColumn":
						VirmanList[e.RowIndex].BrojOdobrenjaPoziv = (System.String)e.Value;
						break;
					case "uxIznosDataGridViewColumn":
						VirmanList[e.RowIndex].Iznos = (System.Decimal)e.Value;
						break;
					case "uxDatumIzvrsenjaDataGridViewColumn":
						VirmanList[e.RowIndex].DatumIzvrsenja = (System.DateTime)e.Value;
						break;
					case "uxPlacenDataGridViewColumn":
						VirmanList[e.RowIndex].Placen = (System.Boolean)e.Value;
						break;
					case "uxIDKnjizenjaDataGridViewColumn":
						VirmanList[e.RowIndex].IDKnjizenja = (System.Int32?)e.Value;
						break;
					case "uxIDKlijentDataGridViewColumn":
						VirmanList[e.RowIndex].IDKlijent = (System.Int32?)e.Value;
						break;
					case "uxCalculatedDataGridViewColumn":
						VirmanList[e.RowIndex].Calculated = (System.Int32?)e.Value;
						break;
					case "uxDatumDospijecaDataGridViewColumn":
						VirmanList[e.RowIndex].DatumDospijeca = (System.DateTime?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
